﻿using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using QDT.Core.Orders;

namespace QDT.Core.MSData.Mapping.Orders
{
    public class ChargeOrderMapping : EntityTypeConfiguration<ChargeOrder>
    {
        public ChargeOrderMapping() {
            
            HasKey(x => x.ID);
            Property(x => x.OrderSN).HasColumnName("order_sn");
            Property(x => x.UserID).HasColumnName("user_id");
            Property(x => x.InnerStatus).HasColumnName("status");
            Property(x => x.TotalPrice).HasColumnName("total_price");
            Property(x => x.PayAmount).HasColumnName("pay_amount");
            Property(x => x.PaymentKey).HasColumnName("payment_key");
            Property(x => x.BankCode).HasColumnName("bank_code");
            Property(x => x.IsDelete).HasColumnName("is_delete");
            Property(x => x.Memo).HasColumnName("memo");
            Property(x => x.AdminMemo).HasColumnName("admin_memo");
            Property(x => x.CreateTime).HasColumnName("create_time");
            Property(x => x.UpdateTime).HasColumnName("update_time");

            //Property(x=>x.Memo).IsConcurrencyToken()

            HasMany(x => x.Logs).WithOptional().HasForeignKey(x => x.OrderID).WillCascadeOnDelete(true);

            ToTable(DB.TPref("charge_order"));
        }
    }
}
